//
//  ECommonHeader.h
//  E_Reader
//
//  Created by 阿虎 on 2017/3/20.
//  Copyright © 2017年 tigerWF. All rights reserved.
//

#ifndef ECommonHeader_h
#define ECommonHeader_h


#define ESAVEPAGE @"ESAVEPAGE"//当前第几页
#define ESAVECHAPTER @"ESAVECHAPTER"//当前章节数
#define EFONT_SIZE @"EFONT_SIZE"//字号大小
#define ETHEMEID @"ETHEMEID"//主题
#define EpubBookName @"epubBookName"

#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))


#define offSet_x 20
#define offSet_y 40

#define kReaderWidth (SCREEN_MIN_LENGTH - 2 * offSet_x)
#define kReaderHeight (SCREEN_MAX_LENGTH - offSet_y - 20)

#define kBottomBarH 150

#define WS(weakSelf)  __weak __typeof(self)weakSelf = self;

#define DELAYEXECUTE(delayTime,func) (dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayTime * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{func;}))

#warning todo -需自行替换
#define kChapterListUrl @"http://51zan.cc/test/chapterList_json2"
#define kChapterInfoUrl @"http://51zan.cc/test/"
#ifndef __OPTIMIZE__

#ifndef RGBA
#define RGBA(r,g,b,a) [UIColor colorWithRed:(float)r/255.0f green:(float)g/255.0f blue:(float)b/255.0f alpha:a]
#define RGBCOLORV(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0x00FF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0x0000FF))/255.0 \
alpha:1.0]

#endif


#define NSLog(...) printf("%f %s %ld :%s\n",[[NSDate date]timeIntervalSince1970],strrchr(__FILE__,'/'),[[NSNumber numberWithInt:__LINE__] integerValue],[[NSString stringWithFormat:__VA_ARGS__]UTF8String]);



#endif

#endif /* ECommonHeader_h */
